package com.xuecheng.content.api;

import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author Fan
 * @Date 2024-01-15 13:41
 * @ClassName: CourseTeacherController
 * @Description: 教资管理
 */
@Slf4j
@RestController
public class CourseTeacherController {

    @Autowired
    CourseTeacherService courseTeacherService;

    /**
     * @description 查询教资人员
     * @date 2024-01-15 13:43
     */
    @GetMapping("/courseTeacher/list/{id}")
    public List<CourseTeacher> queryCourseTeacher(@PathVariable long id){
        return courseTeacherService.queryCourseTeacher(id);
    }
    

    /**
     * @description 添加教师
     * @date 2024-01-15 16:47
     */
    @PostMapping("/courseTeacher")
    public CourseTeacher addCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        return courseTeacherService.addOrUpdateCourseTeacher(courseTeacher);
    }

    /**
     * 删除教师
     */
    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void detTeacher(@PathVariable long courseId,@PathVariable long teacherId){
        courseTeacherService.detTeacher(courseId,teacherId);
    }









}
